//
//  ForumViewController.m
//  CarHome
//
//  Created by 王建男 on 14-9-17.
//  Copyright (c) 2014年 WJN_work@163.com. All rights reserved.
//

#import "ForumViewController.h"
#import "ForumTableViewCell.h"
#import "ForumTableViewCellTwo.h"
#import "UIImageView+WebCache.h"
#import "DayModel.h"
#import "ButtonAction.h"
#import "Day33Button.h"
#import "CollectionCell.h"
#import "JingSelectFuckBoomController.h"
#import "KindOfCar.h"
#import "ZhuTiModel.h"
#import "ProvinceModel.h"
#import "CarTableViewCell.h"
#import "BBSViewController.h"
#import "CarView_Froum.h"
#import "CustomButton.h"
#import "KindofCarModel.h"
NSString * const cellName_Froum = @"cell";
NSString * const cellNameTwo_Froum =@"cell2";
NSString * const cellNameBBS_Froum = @"cell_BBS";
NSString * const itemsName_Froum = @"collect";

@interface ForumViewController ()
@property (nonatomic , retain) UISegmentedControl * segmentedControl_Forum_fenLan;
//分栏
@property (nonatomic , retain) UIScrollView * scrollview_Forum_gunDong;//滚动视图
@property (nonatomic , retain) UIButton * button_Forum_XiaLa;//下拉按钮
@property (nonatomic , retain) UICollectionView * collection_Forum_up;//上侧
@property (nonatomic , retain) UICollectionView * collection_Forum_down;
@property (nonatomic , copy) NSMutableArray * nsmutableArray_Forum_up;
@property (nonatomic , copy) NSMutableArray * nsmutableArray_Forum_down;
@property (nonatomic , retain) UIView * view_Forum_JingXuan;//精选日报
@property (nonatomic , retain) UIView * view_Forum_ChangYong;//常用论坛
@property (nonatomic , retain) UIView * view_Forum_FuZai;//scrollView的负载视图
@property (nonatomic , retain) UITableView * tableView_Forum_tableView;
@property (nonatomic , retain) UITableView * tableView_Forum_tableViewForum;//车系tableview
@property (nonatomic , retain) UIView * view_Forum_sidebar;//常用论坛的侧边栏
@property (nonatomic , copy)    NSMutableDictionary * dictionary_Forum_XiangQing;

@property (nonatomic , copy) NSMutableArray * array_Forum_LinShi;
@property (nonatomic , retain) UICollectionView * collection_Froum_collectBBS;//没用了
@property (nonatomic , retain) UICollectionView * collection_Froum_collectLeft;//左侧collection 3个
@property (nonatomic , retain) ButtonAction * action;
@property (nonatomic , retain) UICollectionView * collection_Froum_button33;//33个
//@property (nonatomic , retain) ButtonAction * button_Froum_value33Btuuon;//把自定义view设置成属性
@property (nonatomic , assign) NSInteger a;//仅用来计数

@property (nonatomic , retain) NSMutableArray * b;//仅用来计数,第一次显示33个按钮用
@property( nonatomic, retain) NSMutableArray * array_Forum_jump;
@property (nonatomic , retain) NSMutableArray * array;//和精选日包传递
@property (nonatomic , retain) NSMutableArray * kindCar;//汽车数组
@property (nonatomic , retain) NSMutableArray * array_Forum_Province;//省份
@property (nonatomic , retain) NSMutableArray * array_Forum_ZhuTi;
@property (nonatomic , retain) NSMutableArray * titleArray;
//车系字母
@property (nonatomic , retain) NSMutableArray * tableArray;//车系内容
@property (nonatomic , retain) NSMutableArray * bigArray;//临时车系数组
@property (nonatomic , retain) NSMutableArray * titleArray_province;//省份字母
@property (nonatomic , retain) NSMutableArray * bigArray_province;//省份临时数组
@property (nonatomic , retain) NSMutableArray * province;//省份名
@property (nonatomic , retain) UITableView * tableView_Froum_KindOfCar;//没用了
@property (nonatomic , retain) UITableView * tableView_Froum_Province;//省份tableview
@property (nonatomic , retain) UITableView * tableView_Froum_ZhuTi;//主题tableView
@property (nonatomic , retain) NSMutableArray * bbs;
@property (nonatomic , assign) BOOL value;//判断下拉还是上拉
@property (nonatomic , assign) NSInteger  urlFresh;//上拉刷新传递的网址
@property (nonatomic , retain) CustomButton * customButton;//自定义button
@property (nonatomic , retain) Day33Button * model1;


@property (nonatomic, retain) NSIndexPath * selectedIndexPath;//老孟加的，然后还有bug，不用了
@property (nonatomic , assign) NSInteger count;
@end

@implementation ForumViewController



- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
        
        self.b = [[NSMutableArray alloc]init];
        
        self.array = [[NSMutableArray alloc]init];
        self.array_Forum_jump = [[NSMutableArray alloc]init];
 
        self.dictionary_Forum_XiangQing = [[NSMutableDictionary alloc]init];
        self.kindCar = [[NSMutableArray alloc]init];
        _array_Forum_LinShi = [[NSMutableArray alloc]init];
        self.array_Forum_Province = [[NSMutableArray alloc]init];
        self.array_Forum_ZhuTi = [[NSMutableArray alloc]init];
        self.titleArray = [[NSMutableArray alloc]init];
        self.tableArray = [[NSMutableArray alloc]init];
        self.bigArray = [[NSMutableArray alloc]init];
        self.bigArray_province = [[NSMutableArray alloc]init];
        self.titleArray_province = [[NSMutableArray alloc]init];
        self.province = [[NSMutableArray alloc]init];
        self.bbs = [[NSMutableArray alloc]init];
        _value = YES;
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];

    
    self.navigationController.navigationBar.barTintColor = myColor_dark;
    self.navigationController.navigationBar.barTintColor = myColor_dark;
    self.tabBarController.tabBar.barTintColor = myColor_dark;//tabBar颜色
    self.navigationController.navigationBar.translucent = NO;
    [self.view setBackgroundColor:[UIColor darkGrayColor]];

    // Do any additional setup after loading the view.
    
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(jump:) name:@"ccc" object:nil];
    _action = [[ButtonAction alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];
    [_action.buttonAction_button addTarget:self action:@selector(buttonAction33:) forControlEvents:UIControlEventTouchUpInside];
    [self connect];
    
    
    
}

#pragma mark -
#pragma mark 隐藏tabBar

- (void)scrollViewWillBeginDecelerating:(UIScrollView *)scrollView
{
    if (scrollView ==  _tableView_Forum_tableView) {
        
        [self.tabBarController.tabBar setHidden:YES];
    }
}

- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView
{
    if (scrollView ==  _tableView_Forum_tableView) {
        
        [self.tabBarController.tabBar setHidden:NO];
    }
}

- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView
{
    if (scrollView ==  _tableView_Forum_tableView) {
        
        [self.tabBarController.tabBar setHidden:YES];
    }
}

- (void)scrollViewWillEndDragging:(UIScrollView *)scrollView withVelocity:(CGPoint)velocity targetContentOffset:(inout CGPoint *)targetContentOffset
{
    if (scrollView ==  _tableView_Forum_tableView) {
        
        [self.tabBarController.tabBar setHidden:NO];
    }
}



#pragma mark - 
#pragma mark 确认并保存
- (void)buttonAction33:(id)sender
{//归档 be_add
    NSData * data_be_add = [NSKeyedArchiver archivedDataWithRootObject:_action.content_be_add];
    NSString * path_be_add = [NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES) firstObject];
    path_be_add = [NSString stringWithFormat:@"%@/%@",path_be_add,@"be_addd.txt"];
    [data_be_add writeToFile:path_be_add atomically:YES];
    
    //归档_add
    NSData * data_add = [NSKeyedArchiver archivedDataWithRootObject:_action.content_add];
    NSString * path_add = [NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES) firstObject];
    path_add = [NSString stringWithFormat:@"%@/%@",path_add,@"_addd.txt"];
    [data_add writeToFile:path_add atomically:YES];
    [_customButton removeFromSuperview];
    [_b removeAllObjects];
    [_b addObjectsFromArray:_action.content_be_add];
    [_collection_Froum_button33 reloadData];
    [_action.view_add removeFromSuperview];
    _value = YES;
    
}

#pragma mark -
#pragma mark 创建CreatTableView - 精选日报
- (void)creatTableView
{
    _tableView_Forum_tableView = [[UITableView alloc]initWithFrame:CGRectMake(0, 30, self.view.frame.size.width, self.view.frame.size.height - 49 - 30) style:UITableViewStylePlain];
    
    _tableView_Forum_tableView.delegate = self;
    _tableView_Forum_tableView.dataSource = self;
    [_tableView_Forum_tableView setSeparatorStyle:UITableViewCellSeparatorStyleSingleLine];
    [_tableView_Forum_tableView setSeparatorColor:[UIColor darkGrayColor]];
   // _tableView_Forum_tableView.tableHeaderView = _view_Forum_FuZai;
    [_tableView_Forum_tableView registerClass:[ForumTableViewCell class] forCellReuseIdentifier:cellName_Froum];
    [_tableView_Forum_tableView registerClass:[ForumTableViewCellTwo class] forCellReuseIdentifier:cellNameTwo_Froum];
       [_view_Forum_JingXuan addSubview:_tableView_Forum_tableView];
    [self setupRefresh];
    
}
#pragma mark -
#pragma mark 创建TableView - 常用论坛
- (void)creatTableViewForum
{

    
    _tableView_Forum_tableViewForum = [[UITableView alloc]initWithFrame:CGRectMake(80, 0, self.view.frame.size.width - 80, self.view.frame.size.height - 49) style:UITableViewStylePlain];
    _tableView_Forum_tableViewForum.delegate = self;
    _tableView_Forum_tableViewForum.dataSource = self;
    //[_tableView_Forum_tableViewForum setBackgroundColor:[UIColor purpleColor]];
    [_tableView_Forum_tableViewForum setSeparatorStyle:UITableViewCellSeparatorStyleSingleLine];
    [_tableView_Forum_tableViewForum setSeparatorColor:[UIColor darkGrayColor]];
    
  
    [_tableView_Forum_tableViewForum registerClass:[CarTableViewCell class] forCellReuseIdentifier:cellNameBBS_Froum];
    [_view_Forum_ChangYong addSubview:_tableView_Forum_tableViewForum];
    [self setupRefresh];
    
}
- (void)creatTableViewThree
{
    _tableView_Froum_Province = [[UITableView alloc]initWithFrame:CGRectMake(80, 0, self.view.frame.size.width - 80, self.view.frame.size.height - 49 - 20) style:UITableViewStylePlain];
    _tableView_Froum_Province.delegate = self;
    _tableView_Froum_Province.dataSource = self;
    _tableView_Froum_ZhuTi = [[UITableView alloc]initWithFrame:CGRectMake(80, 0, self.view.frame.size.width - 80, self.view.frame.size.height - 49 -64) style:UITableViewStylePlain];
    _tableView_Froum_ZhuTi.delegate = self;
    _tableView_Froum_ZhuTi.dataSource = self;
    [_tableView_Froum_Province registerClass:[UITableViewCell class] forCellReuseIdentifier:@"province"];
    [_tableView_Froum_ZhuTi registerClass:[UITableViewCell class] forCellReuseIdentifier:@"zhuti"];
    [_view_Forum_ChangYong addSubview:_tableView_Froum_ZhuTi];
    [_view_Forum_ChangYong addSubview:_tableView_Froum_Province];
    [_view_Forum_ChangYong sendSubviewToBack:_tableView_Froum_ZhuTi];
    [_view_Forum_ChangYong sendSubviewToBack:_tableView_Froum_Province];
    
}
#pragma mark -
#pragma mark 添加A-Z字母
- (NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView
{
    NSMutableArray * array = [[NSMutableArray alloc]init];
    if (tableView == _tableView_Forum_tableViewForum) {
        //添加26字母
        for (int i = 0; i<26; i++) {
            NSString * name = [NSString stringWithFormat:@"%c",65+i];
            [array addObject:name];
        }
    }
    
    return array;
}
//使背景暴露出来
//- (NSString *)tableView:(UITableView *)tableView titleForFooterInSection:(NSInteger)section
//{
//    if (tableView == _tableView_Forum_tableViewForum) {
//         return @" ";
//    }
//   return @" ";
//}
#pragma mark -
#pragma mark 添加TableView的头标题
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
{
    
    if (tableView == _tableView_Forum_tableViewForum) {
       NSString * name = [_titleArray objectAtIndex:section];
        return name;
       
    }
   
    if (tableView == _tableView_Froum_Province) {
        NSString * name =  [_titleArray_province objectAtIndex:section];
        return name;
    }
    if (tableView == _tableView_Froum_ZhuTi) {
        return nil;
    }
    return @"";
}
//#pragma mark -
//#pragma mark 返回TableView的Section颜色 +头标题
//- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
//{
//    UIView * view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 20)];
//    [view setBackgroundColor:[UIColor grayColor]];
//    return [view autorelease];
//}
#pragma mark -
#pragma mark CollectionView 的Section数量
-(NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView
{
    if (collectionView == _collection_Froum_collectLeft) {
        return 1;
    }
    if (collectionView == _collection_Froum_collectBBS) {
        return 26;
    }
    return 1;
}

#pragma mark -
#pragma mark 创建CollectionView和下拉Button,并且创建负载视图
- (void)creatScrollView
{
   
    UICollectionViewFlowLayout * layoutBtuuon33 = [[UICollectionViewFlowLayout alloc]init];
    [layoutBtuuon33 setScrollDirection:UICollectionViewScrollDirectionHorizontal];

    _collection_Froum_button33 = [[UICollectionView alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width - 70, 30)collectionViewLayout:layoutBtuuon33];
    
    [_collection_Froum_button33 setBackgroundColor:[UIColor colorWithWhite:0.1 alpha:0.95]];
    _collection_Froum_button33.delegate = self;
    _collection_Froum_button33.dataSource = self;
    [_collection_Froum_button33 setBackgroundColor:[UIColor blackColor]];
    [_collection_Froum_button33 registerClass:[CollectionCell class] forCellWithReuseIdentifier:@"33button"];
    [_view_Forum_JingXuan addSubview:_collection_Froum_button33];
    [_collection_Froum_button33 setContentInset:UIEdgeInsetsMake(0, 0, 0, -320)];
    [_collection_Froum_button33 setShowsHorizontalScrollIndicator:NO];
    


       // [_view_Forum_JingXuan addSubview:button];
    
}
#pragma mark -
#pragma mark 下拉按钮  下拉按钮 下拉按钮
- (void)XiaLaButton
{
    //创建下拉按钮
    
    _button_Forum_XiaLa = [[UIButton alloc]initWithFrame:CGRectMake(260, 0, 60, 30)];
    [_view_Forum_JingXuan addSubview:_button_Forum_XiaLa];
    
    
    [_button_Forum_XiaLa addTarget:self action:@selector(buttonAction:) forControlEvents:UIControlEventTouchUpInside];
    [_button_Forum_XiaLa setImage:[UIImage imageNamed:@"Depredate_DrawerButton.png"] forState:UIControlStateNormal];

}

#pragma mark -
#pragma mark Collection 点击事件  Button
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
{
   

    if (collectionView == _collection_Froum_button33) {
        self.selectedIndexPath = indexPath;
        _count = [_b count];
        CollectionCell * cell =(CollectionCell *)[collectionView cellForItemAtIndexPath:indexPath];
        cell.label.textColor = [UIColor redColor];
        [_array_Forum_LinShi removeAllObjects];
        Day33Button * model = [_b objectAtIndex:indexPath.item];
        NSString * nameUrl = [NSString stringWithFormat:@"http://app.api.autohome.com.cn/autov4.2/club/jingxuantopic-a2-pm1-v4.2.0-c%@-p1-s30.html",model.value];
        _urlFresh = [model.value intValue];
        [NetUrl connect:nameUrl parmater:nil Block:^(NSData *data) {
            NSMutableDictionary * dic = (NSMutableDictionary *)data;
            id object =  [dic objectForKey:@"result"];
            NSMutableDictionary * dic1 = [NSMutableDictionary dictionaryWithDictionary:object];
            for (NSMutableDictionary * dic5 in [dic1 objectForKey:@"list"]) {
                DayModel * model = [[DayModel alloc]init];
                model.urlImage_smallpic = [dic5 objectForKey:@"smallpic"];
                model.title = [dic5 objectForKey:@"title"];
                model.replycounts = [dic5 objectForKey:@"replycounts"];
                model.toppicid = [dic5 objectForKey:@"topicid"];
                
                [_array_Forum_LinShi addObject:model];
                
                
            }
            [_tableView_Forum_tableView setContentOffset:CGPointMake(0, 0)];
            [_tableView_Forum_tableView reloadData];
        }];
        
        _model1 = [_b objectAtIndex:indexPath.row];
    }
    if (collectionView == _collection_Froum_collectLeft) {
        UICollectionViewCell * cell = (CollectionCell *)[collectionView cellForItemAtIndexPath:indexPath];
        
        _tableView_Forum_tableViewForum.tag = indexPath.item;
        if (_tableView_Forum_tableViewForum.tag == 0) {
            [_tableView_Forum_tableViewForum reloadData];
            [_view_Forum_ChangYong bringSubviewToFront:_tableView_Forum_tableViewForum];
        }
        if (_tableView_Forum_tableViewForum.tag == 1) {
            [_view_Forum_ChangYong bringSubviewToFront:_tableView_Froum_Province];
            [_tableView_Froum_Province reloadData];
        }
        if (_tableView_Forum_tableViewForum.tag == 2) {
            [_view_Forum_ChangYong bringSubviewToFront:_tableView_Froum_ZhuTi];
            [_tableView_Froum_ZhuTi reloadData];

        }
        
        
        if (cell.selected == YES) {
            NSArray *picture = [NSArray arrayWithObjects:@"Forum_CarButton_clicked1.png", @"Forum_LocationButton_clicked1.png", @"Forum_ThemButton_clicked1.png", nil];
            
            UIImageView * image2 = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 70, 70)];
            [image2 setImage:[UIImage imageNamed:[picture objectAtIndex:indexPath.item]]];
            [cell  setSelectedBackgroundView:image2];
            
        }


    }
   
}
#pragma mark -
#pragma mark -
#pragma mark 取消点击
- (void)collectionView:(UICollectionView *)collectionView didDeselectItemAtIndexPath:(NSIndexPath *)indexPath
{
    if (collectionView == _collection_Froum_button33) {
        
        CollectionCell * cell = (CollectionCell *)[collectionView cellForItemAtIndexPath:indexPath];
        
        cell.label.textColor = [UIColor whiteColor];

    }
}


#pragma mark -
#pragma mark Button 点击事件
- (void)buttonAction:(id)sender
{
    
    if (_value == YES) {
        _customButton = [[CustomButton alloc]initWithFrame:CGRectMake(260, 0, 60, 30)];
        [_view_Forum_JingXuan addSubview:_customButton];
        [_customButton addTarget:self action:@selector(buttonAction:) forControlEvents:UIControlEventTouchUpInside];
        
        [self.tabBarController.view addSubview:_action.view_add];
        _value = NO;
    }
    else  if (_value == NO) {
        NSData * data_be_add = [NSKeyedArchiver archivedDataWithRootObject:_action.content_be_add];
        NSString * path_be_add = [NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES) firstObject];
        path_be_add = [NSString stringWithFormat:@"%@/%@",path_be_add,@"be_addd.txt"];
        [data_be_add writeToFile:path_be_add atomically:YES];
        
        
        NSData * data_add = [NSKeyedArchiver archivedDataWithRootObject:_action.content_add];
        NSString * path_add = [NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES) firstObject];
        path_add = [NSString stringWithFormat:@"%@/%@",path_add,@"_addd.txt"];
        [data_add writeToFile:path_add atomically:YES];
        [_customButton removeFromSuperview];
        [_b removeAllObjects];
        [_b addObjectsFromArray:_action.content_be_add];
        [_collection_Froum_button33 reloadData];
        [_action.view_add removeFromSuperview];
        _value = YES;
    }
   
}



#pragma mark -
#pragma mark 创建精选日报View  和 常用论坛VIew //////
- (void)creatView
{
    //创建视图 - 精选日报
    _view_Forum_JingXuan = [[UIView alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height - 64)];
    [_view_Forum_JingXuan setBackgroundColor:[UIColor blackColor]];
    
    //创建视图 - 常用论坛
    _view_Forum_ChangYong = [[UIView alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];
    [_view_Forum_ChangYong setBackgroundColor:[UIColor redColor]];
    //创建常用论坛的侧边栏
    _view_Forum_sidebar = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 80, self.view.frame.size.height - 64)];
    [_view_Forum_ChangYong addSubview:_view_Forum_sidebar];
    [self creatCollection];
    
}
#pragma mark -
#pragma mark 常用论坛的左侧CollectionView
- (void)creatCollection
{
    UICollectionViewFlowLayout * layout = [[UICollectionViewFlowLayout alloc]init];
    layout.minimumLineSpacing = 40;
    layout.headerReferenceSize = CGSizeMake(0, 20);
 
    _collection_Froum_collectLeft = [[UICollectionView alloc]initWithFrame:CGRectMake(0, 0, 80, self.view.frame.size.height) collectionViewLayout:layout];
    _collection_Froum_collectLeft.alwaysBounceVertical = YES;
    _collection_Froum_collectLeft.delegate = self;
    _collection_Froum_collectLeft.dataSource = self;
    [_collection_Froum_collectLeft registerClass:[UICollectionViewCell class] forCellWithReuseIdentifier:itemsName_Froum];
    


    UIColor * color = myColor_dark;
    [_collection_Froum_collectLeft setBackgroundColor:color];
    [_view_Forum_sidebar addSubview:_collection_Froum_collectLeft];
    
    
    
}
#pragma mark -
#pragma mark CollectionView   items的数量
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
{
   
    
    if (collectionView == _collection_Froum_collectLeft) {
        return 3;
    }

    if (collectionView == _collection_Froum_button33) {
            return [_b count];
    }

    return 4;
}
#pragma mark -
#pragma mark CollectionView  创建重建池
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
    
    if (collectionView == _collection_Froum_collectLeft) {
        NSArray *picture = [NSArray arrayWithObjects:@"Forum_CarButton1.png", @"Forum_LocationButton1.png", @"Forum_ThemButton1.png", nil];
        
        UICollectionViewCell * items = [collectionView dequeueReusableCellWithReuseIdentifier:itemsName_Froum forIndexPath:indexPath];
        [items setBackgroundColor:[UIColor clearColor]];
        //以前有4个，现在没有用了
        if (indexPath.row < 3) {
            UIImageView * image = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 70, 70)];
            
            [image setImage:[UIImage imageNamed:[picture objectAtIndex:indexPath.row]]];
            [items setBackgroundView:image];
            return items;
        }
        
    }
    if (collectionView == _collection_Froum_button33) {
        CollectionCell * cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"33button" forIndexPath:indexPath];
        Day33Button * model = [_b objectAtIndex:indexPath.row];
        [cell.label setText:model.name33];
        [cell.label setTextColor:[UIColor whiteColor]];
        cell.label.font = [UIFont systemFontOfSize:14];
        
        [cell.label setBackgroundColor:[UIColor clearColor]];
        
        if (self.selectedIndexPath == indexPath) {
            
            if (_count == [_b count]) {
                
                cell.label.textColor = [UIColor redColor];
            }
            else
            {
                cell.label.textColor = [UIColor whiteColor];
            }
        }
        return cell;
    }
    return 0;
    
}

#pragma mark -
#pragma mark CollectionView 的大小
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath
{
    if (collectionView == _collection_Froum_button33) {
        return CGSizeMake(70, 30);
    }
    if (collectionView == _collection_Froum_collectLeft) {
        
        return CGSizeMake(70, 70);
    }
    return  CGSizeMake(0, 0);
}
//////section之间的间距//////////////
#pragma mark - 
#pragma mark CollectionView 的Section的间距
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout referenceSizeForFooterInSection:(NSInteger)section
{
    return CGSizeMake(320, 60);
}

#pragma mark -
#pragma mark 创建segment分栏
- (void)creatSegmentControl
{


    //创建 - 精选日报 - 常用论坛
    NSArray * segMentName = [NSArray arrayWithObjects:@"精选日报",@"常用论坛", nil];
    UISegmentedControl * segment = [[UISegmentedControl alloc]initWithItems:segMentName];
    
    UIFont *font = [UIFont boldSystemFontOfSize:16.0f];
    NSDictionary *attributes = [NSDictionary dictionaryWithObject:font forKey:NSFontAttributeName];
    [segment setTitleTextAttributes:attributes
                        forState:UIControlStateNormal];
    
    [segment setTintColor:[UIColor whiteColor]];//颜色
    [segment setWidth:80 forSegmentAtIndex:0];
    [segment setWidth:80 forSegmentAtIndex:1];
    
    
    segment.selectedSegmentIndex = 0;
    [self.view addSubview:_view_Forum_ChangYong];
    [self.view addSubview:_view_Forum_JingXuan];
    [self.view bringSubviewToFront:_view_Forum_JingXuan];
    [segment addTarget:self action:@selector(segmentAction:) forControlEvents:UIControlEventValueChanged];
    [self.navigationItem setTitleView:segment];
    
}

#pragma mark -
#pragma mark 分栏点击 - 精选日报 - 常用论坛
- (void)segmentAction:(UISegmentedControl *)sender
{
    switch (sender.selectedSegmentIndex) {
        case 0:
            [self.view bringSubviewToFront:_view_Forum_JingXuan];
            //[self.view addSubview:_view_Forum_JingXuan];
            break;
        case 1:
            [self.view bringSubviewToFront:_view_Forum_ChangYong];
            NSData * data_be_add = [NSKeyedArchiver archivedDataWithRootObject:_action.content_be_add];
            NSString * path_be_add = [NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES) firstObject];
            path_be_add = [NSString stringWithFormat:@"%@/%@",path_be_add,@"be_addd.txt"];
            [data_be_add writeToFile:path_be_add atomically:YES];
            
            
            NSData * data_add = [NSKeyedArchiver archivedDataWithRootObject:_action.content_add];
            NSString * path_add = [NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES) firstObject];
            path_add = [NSString stringWithFormat:@"%@/%@",path_add,@"_addd.txt"];
            [data_add writeToFile:path_add atomically:YES];
            [_customButton removeFromSuperview];
            [_b removeAllObjects];
            [_b addObjectsFromArray:_action.content_be_add];
            [_collection_Froum_button33 reloadData];
            [_action.view_add removeFromSuperview];
            _value = YES;

            //[self.view addSubview:_view_Forum_ChangYong];
            break;
        default:
            break;
    }
}
#pragma mark -
#pragma mark 返回TableView的行数
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    if (tableView == _tableView_Forum_tableView) {
       
        return [_array_Forum_LinShi count];
    }
    if (tableView == _tableView_Forum_tableViewForum) {
        return [[_tableArray objectAtIndex:section] count];
    }
    if (tableView == _tableView_Froum_ZhuTi) {
        return  [_array_Forum_ZhuTi count];
    }
    if (tableView == _tableView_Froum_Province) {
        return [[_array_Forum_Province objectAtIndex:section] count];
    }
    return 0;
    
}
#pragma mark -
#pragma mark 返回TableView的Section数量
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    if (tableView == _tableView_Forum_tableView) {
        return 1;
    }
    if (tableView == _tableView_Forum_tableViewForum) {
       
        return [_tableArray count];
    }
   
    if (tableView == _tableView_Froum_ZhuTi) {
        return 2;
    }
    if (tableView == _tableView_Froum_Province) {
        return [_array_Forum_Province count];
    }
    return 1;
}
#pragma mark -
#pragma mark 返回TableView的Section高度
- (CGFloat) tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (tableView == _tableView_Forum_tableView) {
        return 160;
    }
    if (tableView == _tableView_Forum_tableViewForum) {
        return 40;
    }
    if (tableView == _tableView_Froum_Province) {
        return 30;
    }
    if (tableView == _tableView_Froum_ZhuTi) {
        return 30;
    }
    return 40;
}
#pragma mark - 
#pragma mark TableView 点击事件
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (tableView == _tableView_Forum_tableView) {
        DayModel * model =  [_array_Forum_LinShi objectAtIndex:indexPath.row];
        NSString * name = [NSString stringWithFormat:@"http://forum.app.autohome.com.cn/autov4.2/forum/club/topiccontent-a2-pm1-v4.2.0-t%@-o0-p1-s20-c1-nt0-fs0-sp0-al0-cw320.html",model.toppicid];
        JingSelectFuckBoomController * jingXuanRiBao = [[JingSelectFuckBoomController alloc]init];
        
        jingXuanRiBao.name33 = _model1.name33;
        jingXuanRiBao.name = name;
        [self.navigationController pushViewController:jingXuanRiBao animated:YES];
    }
    if (tableView == _tableView_Forum_tableViewForum) {
        
        CarView_Froum * carView_froum = [[CarView_Froum alloc]initWithFrame:CGRectMake(80, 0, 240, 480)];
        
        carView_froum.carArray = [NSMutableArray arrayWithArray:[[[_tableArray objectAtIndex:indexPath.section]objectAtIndex:indexPath.row]objectForKey:@"seriesclub"]];
        carView_froum.arr = [NSMutableArray arrayWithArray:_tableArray];
        
        
        [self.view_Forum_ChangYong addSubview:carView_froum];
               
      
    }
    if (tableView == _tableView_Froum_Province) {

        NSInteger bbsid =[[NSString stringWithFormat:@"%@",[[[_array_Forum_Province objectAtIndex:indexPath.section] objectAtIndex:indexPath.row] objectForKey:@"bbsid"]]intValue];
        NSString * bbsname =[NSString stringWithFormat:@"%@",[[[_array_Forum_Province objectAtIndex:indexPath.section] objectAtIndex:indexPath.row] objectForKey:@"bbsname"]];
      
        
        BBSViewController * bbs = [[BBSViewController alloc]init];
        bbs.bbsid =bbsid;
        bbs.bbsname = bbsname;
        [self.navigationController pushViewController:bbs animated:YES];
       
    }
    if (tableView == _tableView_Froum_ZhuTi) {
        
        ZhuTiModel * model = [_array_Forum_ZhuTi objectAtIndex:indexPath.row];
        BBSViewController * bbs = [[BBSViewController alloc]init];
         bbs.bbsid = [model.bbsid intValue];
        bbs.bbsname = model.bbsname;
       
        [self.navigationController pushViewController:bbs animated:YES];
    }
    
}
- (void)jump:(NSNotification * )obj
{
    BBSViewController * a = [[BBSViewController alloc]init];
    
    KindofCarModel * model = obj.object;
    a.bbsid = [model.bbsid intValue];
    a.bbsname = model.bbsname;
    [self.navigationController pushViewController:a animated:YES];
}
#pragma mark -
#pragma mark TableView 重建池
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    
    if (tableView == _tableView_Forum_tableView) {
//
        
        //偶数行
        if (indexPath.row % 2 == 0) {
           
                
                ForumTableViewCellTwo * cell2 = [tableView dequeueReusableCellWithIdentifier:cellNameTwo_Froum];
            if ([_array_Forum_LinShi count] != 0) {
                
                DayModel * model = [_array_Forum_LinShi objectAtIndex:indexPath.row];
                
                cell2.labelRightUp.text = model.title;
                cell2.labelRightDown.text = [NSString stringWithFormat:@"%@回复",model.replycounts];
                
                //[cell2.labelRightDown setBackgroundColor:[UIColor whiteColor]];
                [cell2.image sd_setImageWithURL:[NSURL URLWithString:model.urlImage_smallpic]placeholderImage:[UIImage imageNamed:@"Loading.png"]];
                
            }
            return cell2;
        }
        else
        {
                
                ForumTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:cellName_Froum];
            if ([_array_Forum_LinShi count] != 0) {
                
                DayModel * model = [_array_Forum_LinShi objectAtIndex:indexPath.row];
                
                cell.labelLeftDown.text = [NSString stringWithFormat:@"%@回复",model.replycounts];
                
                cell.labelLeftUp.text = model.title;
                [cell.image sd_setImageWithURL:[NSURL URLWithString:model.urlImage_smallpic]placeholderImage:[UIImage imageNamed:@"Loading.png"]];
            }
            return cell;
        }
    }
    if (tableView == _tableView_Forum_tableViewForum) {
               CarTableViewCell * cellCar = [tableView dequeueReusableCellWithIdentifier:cellNameBBS_Froum];
        NSString * arr = [[[_tableArray objectAtIndex:indexPath.section]objectAtIndex:indexPath.row] objectForKey:@"brandname"];
        NSString * picture = [[[_tableArray objectAtIndex:indexPath.section]objectAtIndex:indexPath.row] objectForKey:@"brandimg"];

        [cellCar.label setText:arr];
        [cellCar.myView sd_setImageWithURL:[NSURL URLWithString:picture]placeholderImage:[UIImage imageNamed:@"Loading.png"]];
       
        [cellCar.label setTextColor:[UIColor blackColor]];
        return cellCar;
    }
  
    if (tableView == _tableView_Froum_ZhuTi) {
        ZhuTiModel * model = [_array_Forum_ZhuTi objectAtIndex:indexPath.row];
        UITableViewCell * cellZhuti = [tableView dequeueReusableCellWithIdentifier:@"zhuti"];
        [cellZhuti.textLabel setText:model.bbsname];
        [cellZhuti.textLabel setTextColor:[UIColor blackColor]];
        return cellZhuti;
    }
    if (tableView == _tableView_Froum_Province) {
        UITableViewCell * cellCity = [tableView dequeueReusableCellWithIdentifier:@"province"];
        NSString * arr = [[[_array_Forum_Province objectAtIndex:indexPath.section] objectAtIndex:indexPath.row] objectForKey:@"bbsname"];
        [cellCity.textLabel setText:arr];
        [cellCity.textLabel setTextColor:[UIColor blackColor]];
        return cellCity;
    }
 
    return 0;
    
}
#pragma mark -
#pragma mark setRefresh上拉加载 下拉刷新
- (void)setupRefresh
{
    [_tableView_Forum_tableView addHeaderWithTarget:self action:@selector(headerRereshing)];
    
    //[_tableView_Forum_tableView headerBeginRefreshing]; //程序开始即刷新
    
    [_tableView_Forum_tableView addFooterWithTarget:self action:@selector(footerRereshing)];
    
    
    
    
    _tableView_Forum_tableView.headerPullToRefreshText = @"下拉刷新";
    _tableView_Forum_tableView.headerReleaseToRefreshText = @"释放刷新";
    _tableView_Forum_tableView.headerRefreshingText = @"正在刷新中···";
    _tableView_Forum_tableView.footerPullToRefreshText = @"上拉加载";
    _tableView_Forum_tableView.footerReleaseToRefreshText = @"释放加载";
    _tableView_Forum_tableView.footerRefreshingText = @"正在加载中···";
}
// *******************************************

- (void)headerRereshing
{
    [self connect_mian];
    
    // 2.2秒后刷新表格UI
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
        // 刷新表格
        [_tableView_Forum_tableView reloadData];
        
        // (最好在刷新表格后调用)调用endRefreshing可以结束刷新状态
        [_tableView_Forum_tableView headerEndRefreshing];
        
    });
}
static int a = 1;
- (void)footerRereshing
{
   
    NSMutableString * urlstr = [NSMutableString stringWithFormat:@"http://app.api.autohome.com.cn/autov4.2/club/jingxuantopic-a2-pm1-v4.2.0-c%ld-p%d-s30.html",_urlFresh,a];
    NSRange subStr = [urlstr rangeOfString:[NSString stringWithFormat:@"p%d", a]];
    a++;
    if (subStr.location != NSNotFound) {
        [urlstr replaceCharactersInRange:subStr withString:[NSString stringWithFormat:@"p%d", a]];
    }
    [self connectFooter:urlstr];
    
    
    ////
    
    
    
    ///
    // 2.2秒后刷新表格UI
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
        // 刷新表格
        [_tableView_Forum_tableView reloadData];
        
        // (最好在刷新表格后调用)调用endRefreshing可以结束刷新状态
        [_tableView_Forum_tableView footerEndRefreshing];
        
    });
}
- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
//////////34567uiop456789056uirtyuio//////
- (void)connectFooter:(NSString * )urlstr
{
    [NetUrl connect:urlstr parmater:nil Block:^(NSData *data) {
        NSMutableDictionary * dic = (NSMutableDictionary *)data;
        id object =  [dic objectForKey:@"result"];
        NSMutableDictionary * dic1 = [NSMutableDictionary dictionaryWithDictionary:object];
        
        for (NSMutableDictionary * dic5 in [dic1 objectForKey:@"list"]) {
            DayModel * model = [[DayModel alloc]init];
            model.urlImage_smallpic = [dic5 objectForKey:@"smallpic"];
            model.title = [dic5 objectForKey:@"title"];
            model.replycounts = [dic5 objectForKey:@"replycounts"];
            model.toppicid = [dic5 objectForKey:@"topicid"];
            [_array_Forum_LinShi addObject:model];
            [_collection_Forum_down reloadData];
            [_collection_Forum_up reloadData];
            [_tableView_Forum_tableView reloadData];
        }
        
    }];
}


#pragma mark -
#pragma mark 论坛界面  网络请求
- (void)connect_mian
{
    
    
    NSString * name = [NSString stringWithFormat:@"http://app.api.autohome.com.cn/autov4.2/club/jingxuantopic-a2-pm1-v4.2.0-c%ld-p1-s30.html",_urlFresh];
    [NetUrl connect:name parmater:nil Block:^(NSData *data) {
        NSMutableDictionary * dic = (NSMutableDictionary *)data;
        id object =  [dic objectForKey:@"result"];
        NSMutableDictionary * dic1 = [NSMutableDictionary dictionaryWithDictionary:object];
        [_array_Forum_LinShi removeAllObjects];
        for (NSMutableDictionary * dic5 in [dic1 objectForKey:@"list"]) {
            DayModel * model = [[DayModel alloc]init];
            model.urlImage_smallpic = [dic5 objectForKey:@"smallpic"];
            model.title = [dic5 objectForKey:@"title"];
            model.replycounts = [dic5 objectForKey:@"replycounts"];
            model.toppicid = [dic5 objectForKey:@"topicid"];
            [_array_Forum_LinShi addObject:model];
            [_collection_Forum_down reloadData];
            [_collection_Forum_up reloadData];
            [_tableView_Forum_tableView reloadData];
        }
        [_tableView_Forum_tableView headerEndRefreshing];
        [_tableView_Forum_tableView footerEndRefreshing];
    }];
    
}
#pragma mark - 
#pragma mark Connect 网络请求
- (void)connect
{
    /// 首界面数据
    [NetUrl connect:DayPicture parmater:nil Block:^(NSData *data) {
        NSMutableDictionary * dic = (NSMutableDictionary *)data;
        id object =  [dic objectForKey:@"result"];
        NSMutableDictionary * dic1 = [NSMutableDictionary dictionaryWithDictionary:object];
        for (NSMutableDictionary * dic5 in [dic1 objectForKey:@"list"]) {
            DayModel * model = [[DayModel alloc]init];
            model.urlImage_smallpic = [dic5 objectForKey:@"smallpic"];
            model.title = [dic5 objectForKey:@"title"];
            model.replycounts = [dic5 objectForKey:@"replycounts"];
            model.toppicid = [dic5 objectForKey:@"topicid"];
            [_array_Forum_LinShi addObject:model];
            [_collection_Forum_down reloadData];
            [_collection_Forum_up reloadData];
            [_tableView_Forum_tableView reloadData];
        }
        [_tableView_Forum_tableView headerEndRefreshing];
        [_tableView_Forum_tableView footerEndRefreshing];
    }];
    /// 33个按钮的信息
    //读
    NSString * path_be_add = [NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES) firstObject];
    path_be_add = [NSString stringWithFormat:@"%@/%@",path_be_add,@"be_addd.txt"];
    NSData * data_be_add = [NSData dataWithContentsOfFile:path_be_add];
    NSMutableArray * array_be_add = [NSKeyedUnarchiver unarchiveObjectWithData:data_be_add];
    
    //读
    NSString * path_add = [NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES) firstObject];
    path_add = [NSString stringWithFormat:@"%@/%@",path_add,@"_addd.txt"];
    NSData * data_add = [NSData dataWithContentsOfFile:path_add];
    NSMutableArray * array_add = [NSKeyedUnarchiver unarchiveObjectWithData:data_add];
    
    
    
    
    if ([array_add count] == 0) {
        [NetUrl connect:Day33 parmater:nil Block:^(NSData *data) {
            NSMutableDictionary * dic = (NSMutableDictionary *)data;
            NSMutableDictionary * dic2 = [dic objectForKey:@"result"];
            NSMutableArray * array3 = [dic2 objectForKey:@"metalist"];
            NSMutableDictionary * array4 = [array3 objectAtIndex:4];
            NSMutableArray * array5 = [array4 objectForKey:@"list"];
            for (NSMutableDictionary * dic5 in array5) {
                Day33Button * model = [[Day33Button alloc]init];
                model.name33 = [dic5 objectForKey:@"name"];
                model.type = [dic5 objectForKey:@"type"];
                model.value = [dic5 objectForKey:@"value"];
                
                [_b addObject:model];
                
            }
            [self creatScrollView];
        }];

    }
    else
    {
        [_b addObjectsFromArray:array_be_add];
        //[self creatScrollView];
    }


    

       /// 全国地址

    [NetUrl connect:Province parmater:nil Block:^(NSData *data) {
        
        NSMutableDictionary * bigDic = (NSMutableDictionary *)data;
        id object =  [bigDic objectForKey:@"result"];
        NSMutableDictionary * dic1 = [NSMutableDictionary dictionaryWithDictionary:object];
        id object1 =  [NSMutableArray arrayWithArray:[dic1 objectForKey:@"list"]];
        [_bigArray_province addObjectsFromArray:object1];
        for (NSDictionary *dic in _bigArray_province) {
           // ProvinceModel * model = [[ProvinceModel alloc]init];
            
            [_titleArray_province addObject:[dic objectForKey:@"firstletter"]];
        }
        
        NSSet *set = [NSSet setWithArray:_titleArray_province];
        
        _titleArray_province = (NSMutableArray *)[set allObjects];
        _titleArray_province = [_titleArray_province sortedArrayUsingSelector:@selector(compare:)];
        [_titleArray_province retain];
        
        for (int i = 0; i < [_titleArray_province count]; i++) {
            NSMutableArray *array = [[NSMutableArray alloc] init];
            [_array_Forum_Province addObject:array];
            [array release];
        }
        
        
        
        for (NSDictionary *dic in _bigArray_province) {
            [[_array_Forum_Province objectAtIndex:[_titleArray_province indexOfObject:[dic objectForKey:@"firstletter"]]] addObject:dic];
        }
        

    }];

    
    /// 主题论坛
    [NetUrl connect:ZhuTi parmater:nil Block:^(NSData *data) {
        NSMutableDictionary * dic = (NSMutableDictionary *)data;
        NSMutableDictionary * dic2 = [dic objectForKey:@"result"];
        NSMutableArray * array5 = [dic2 objectForKey:@"list"];
        for (NSMutableDictionary * dic5 in array5) {
            ZhuTiModel * model = [[ZhuTiModel alloc]init];
            model.bbsname = [dic5 objectForKey:@"bbsname"];
            model.bbstype = [dic5 objectForKey:@"bbstype"];
            model.bbsid = [dic5 objectForKey:@"bbsid"];
            
            [_array_Forum_ZhuTi addObject:model];
        }
        
    }];
    
    
    /// 汽车信息
    [NetUrl connect:carcar parmater:nil Block:^(NSData *data) {
        
        NSMutableDictionary * bigDic = (NSMutableDictionary *)data;
        id object =  [bigDic objectForKey:@"result"];
        NSMutableDictionary * dic1 = [NSMutableDictionary dictionaryWithDictionary:object];
        _bigArray = [NSMutableArray arrayWithArray:[dic1 objectForKey:@"list"]];
        for (NSDictionary *dic in _bigArray) {
            [_titleArray addObject:[dic objectForKey:@"letter"]];
        }
        
        NSSet *set = [NSSet setWithArray:_titleArray];
        _titleArray = (NSMutableArray *)[set allObjects];
        [_titleArray retain];
        
        for (int i = 0; i < [self.titleArray count]; i++) {
            NSMutableArray *array = [[NSMutableArray alloc] init];
            [self.tableArray addObject:array];
            [array release];
        }
        
        
        for (NSDictionary *dic in _bigArray) {
            [[_tableArray objectAtIndex:[_titleArray indexOfObject:[dic objectForKey:@"letter"]]] addObject:dic];
        }
        [self creatScrollView];
        [self creatTableViewForum];
    }];
    [self creatView];
    [self creatSegmentControl];
    [self XiaLaButton];
    [self creatTableView];
    [self creatTableViewThree];
    
    
}


- (void)dealloc
{
    [_segmentedControl_Forum_fenLan release];
    _segmentedControl_Forum_fenLan = nil;
    [_scrollview_Forum_gunDong release];
    _scrollview_Forum_gunDong = nil;
    [_button_Forum_XiaLa release];
    _button_Forum_XiaLa = nil;
    [_collection_Forum_down release];
    _collection_Forum_down = nil;
    [_collection_Forum_up release];
    _collection_Forum_up = nil;
    [_nsmutableArray_Forum_down release];
    _nsmutableArray_Forum_down = nil;
    [_nsmutableArray_Forum_up release];
    _nsmutableArray_Forum_up = nil;
    [_view_Forum_ChangYong release];
    _view_Forum_ChangYong = nil;
    [_view_Forum_JingXuan release];
    _view_Forum_JingXuan = nil;
    [_view_Forum_FuZai release];
    _view_Forum_FuZai = nil;
    [_tableView_Forum_tableView release];
    _tableView_Forum_tableView = nil;
    [_tableView_Forum_tableViewForum release];
    _tableView_Forum_tableViewForum = nil;
    [_view_Forum_sidebar release];
    _view_Forum_sidebar = nil;
    [_dictionary_Forum_XiangQing release];
    _dictionary_Forum_XiangQing = nil;

    [_array_Forum_LinShi release];
    _array_Forum_LinShi = nil;
    [_collection_Froum_collectBBS release];
    _collection_Froum_collectBBS = nil;
    [_collection_Froum_collectLeft release];
    _collection_Froum_collectBBS = nil;
    [_action release];
    _action = nil;
    [_collection_Froum_button33 release];
    _collection_Froum_button33 = nil;
    [_b release];
    _b = nil;
    [_array_Forum_jump release];
    _array_Forum_jump = nil;
    [_kindCar release];
    _kindCar = nil;
    [_titleArray release];
    _titleArray = nil;
    [_tableArray release];
    _tableArray = nil;
    [_bigArray release];
    _tableArray = nil;
    [_bigArray_province release];
    _bigArray_province = nil;
    [_titleArray_province release];
    _titleArray_province = nil;
    [_province release];
    _province = nil;
    [_tableView_Froum_KindOfCar release];
    _tableView_Froum_KindOfCar = nil;
    [_tableView_Froum_Province release];
    _tableView_Froum_Province = nil;
    [_tableView_Froum_ZhuTi release];
    _tableView_Froum_ZhuTi = nil;
    [_model1 release];
    _model1 = nil;
    [super dealloc];
}
// *******************************************
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
